-content_for :modal_title do
  Select Systems/Processes

-content_for :modal_help, :select_systems

%script#subsystem_option{ :type => 'text/html', :'data-prefix' => 'system' }
  %li{ :'data-id' => '<%= system.id %>', :'data-title' => '<%= system.title %>', :'data-slug' => '<%= system.slug %>' }
    .row-fluid
      .span8
        .object-info
          %span.name <%= system.title %>
          %span.option <%= system.slug %>
      .span4.actions
        .pull-right
          %a.widgetbtn.btn.btn-mini{:href => edit_flow_system_path('<%=system.id%>'), :'data-toggle' => 'modal-ajax-listeditform', :'data-selector-target' => '.source, .target' }
            %i.grcicon-edit
          %a.widgetbtn.add-me.btn.btn-mini{:href => "#", :'data-toggle' => 'selector-list-select'}
            %i.grcicon-chevron-right

%script#subsystem_option_data{ :type => 'text/html' }
  .object-info
    %span.name <%= system.title %>
    %span.option <%= system.slug %>

%script#subsystem_selected{ :type => 'text/html', :'data-mappings' => 'child:system,object:system', :'data-member' => 'system_system' }
  %li{ :'data-id' => '<%= id %>', :'data-object-id' => '<%= system.id %>' }
    .row-fluid
      .help-inline
      .span6.object_info{ :'data-template-id' => 'subsystem_option_data' }
      .span6.actions
        %span.state
        .pull-right
          %input{ :type => 'hidden', :name => 'items[<%= id %>][id]', :value => '<% if (id.toString().substr(0,3) != "new") { %><%= id %><% } %>'.html_safe }
          %input{ :type => 'hidden', :name => 'items[<%= id %>][parent_id]', :value => object.id }
          %input{ :type => 'hidden', :name => 'items[<%= id %>][child_id]', :value => '<%= system.id %>' }
          %input._destroy{ :type => 'hidden', :name => 'items[<%= id %>][_destroy]', :value => '' }
          %a.widgetbtn.btn.btn-mini{ :href => edit_flow_system_path('<%=system.id%>'), :'data-toggle' => 'modal-ajax-listeditform', :'data-selector-target' => '.source, .target' }
            %i.grcicon-edit
          %a.widgetbtn.btn.btn-mini{ :href => '#', :'data-toggle' => 'selector-list-remove' }
            %i.grcicon-remove

.row-fluid.modal-source
  .span6
    .row-fluid
      .span7
        %h3
          Add System/Process
          %a.widgetbtn.widgetbtnselector.btn.btn-add{ :href => new_flow_system_path, :'data-toggle' => 'modal-ajax-listnewform', :'data-selector-target' => '.source, .target', :'data-modal-class' => 'modal-wide' }
            %i.grcicon-add
      .span5
        %input.widgetsearch.input-block-level{:type => "text", :placeholder => "Search Systems"}

    .filter-block
      .row-fluid
        .span12
          .tabbable.tabs-left
            .tab-content
              #category1.tab-pane.active
                .people-list
                  %ul.source{ :'data-list-data-href' => flow_systems_path(:as_subsystems_for => object.id, :format => :json), :'data-template-id' => 'subsystem_option' }
  .span6
    %h3
      Sub-systems/processes for this system
    .people-list.currentlist
      %ul.target{ :'data-list-data-href' => flow_system_systems_path(:parent_id => object.id, :format => :json), :'data-selector-target' => '.source, .target', :'data-template-id' => 'subsystem_selected'}

.spinner
